#ifndef DATAMANAGER_H
#define DATAMANAGER_H

#include <QObject>
#include <array>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QDebug>
#include <QStringList>
class DataManager : public QObject
{
    Q_OBJECT
public:
    explicit DataManager(QObject *parent = nullptr);

    QByteArray recvCurrentData;

    int Init();

    int OpenPort();

    void RecvData(QSerialPort &serialPort, QByteArray &sendData);
    int SendIntruct(QSerialPort &serialPort, QByteArray &data);
    int AnalyData(std::array<int, 8> &iData);

    QStringList FindAvailableSerialPorts();
    int ConfigureAndOpenSerialPort(QSerialPort &serialPort, const QString &portName, qint32 baudRate);

private:
         //QSerialPort SerialPort;

signals:
};

#endif // DATAMANAGER_H
